"use strict";

const User = use("App/Models/User");

class UserController {
  async register({ request, response }) {
    const { username, password } = request.only(["username", "password"]);
    console.log(username);
    await User.create({
      username,
      password
    });
    return response.send({
      message: true
    });
  }
  async({ request, response, auth }) {
    const data = request.only(["name", "password"]);
    const token = await auth.attempt(username, password);
    return response.json(token);
  }
}

module.exports = UserController;
